import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:ruitmentapp/personnel/widget/zj_tabbar.dart';
import 'package:ruitmentapp/core/extension/create_materialColor.dart';
import 'package:ruitmentapp/core/shared/size_fit.dart';
import 'package:ruitmentapp/personnel/request/zj_personnel_request.dart';
import 'package:ruitmentapp/personnel/model/zj_homeposition_model.dart';
import 'zj_tabbar_two_list_page.dart';

class ACETabBarTwoButtonPage extends StatefulWidget {

  final String _positionid;
  ACETabBarTwoButtonPage(this._positionid, {Key key}) : super(key: key);

  @override
  _ACETabBarTwoButtonPageState createState() => _ACETabBarTwoButtonPageState();
}

class _ACETabBarTwoButtonPageState extends State<ACETabBarTwoButtonPage> with SingleTickerProviderStateMixin {
  TabController _tabController2;

  final List<Widget> _tabData01 = [
    const Tab(text:"推荐"),
    const Tab(text:"最新"),
  ];

  final List<Widget> _tabViewData01 = [

  ];

  @override
  void dispose() {
    _tabController2.dispose();
    super.dispose();
  }

  @override
  void initState() {
    super.initState();
    _tabController2 = TabController(vsync: this, length: 2);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          backgroundColor: const Color(0xFFF3F5F7),
          elevation: 0,
          toolbarHeight: 0,
          bottom: _tabBar05(1, false, true,)
      ),
      body: _tabBarView(),
    );
  }

  _tabBarView() => TabBarView(
      controller: _tabController2,
      children: [
        ZJHomeContentListviewPage('1', widget._positionid),
        ZJHomeContentListviewPage('0', widget._positionid),
      ]
  );

  _tabBar05(type, isLeft, isRight, {isScrollable}) => ACETabBar(
      isScrollable: isScrollable ?? true,
      alignType: ACETabBarAlignType.left,
      labelColor: const Color(0xFF3F4756),
      labelStyle: const TextStyle(color: Colors.green, fontSize: 15),
      labelPadding:const EdgeInsets.only(left: 20),
      unselectedLabelColor: const Color(0xFF77809E),
      unselectedLabelStyle: const TextStyle(color: Colors.purpleAccent, fontSize: 15),
      dragStartBehavior: DragStartBehavior.down,
      indicatorColor:Colors.transparent,
      startIcon: isLeft ? const Padding(
          padding: EdgeInsets.symmetric(horizontal: 10.0),
          child: FlutterLogo())
          : null,
      endIcon: isRight ? GestureDetector(
          onTap: () => print('----endIcon.click----'),
          child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 10.0),
              child: RichText(
                text: TextSpan(
                  text: "郑州 ",
                  style: const TextStyle(color: Color(0xFF77809E), fontSize: 14),
                  children: [
                    WidgetSpan(
                      child: GestureDetector(
                      child: Image.asset("assets/images/home/homebutton.png",width: 6,height: 6),
                        onTap: () {

                        },
                      ),
                  )]
                )
              )
          )
      )
          : null,
      endIcon2: isRight ? GestureDetector(
          onTap: () => print('----endIcon2.click----'),
          child: Padding(
              padding: const EdgeInsets.only(left: 10,right: 20),
              child: RichText(
                  text: TextSpan(
                      text: "筛选 ",
                      style: const TextStyle(color: Color(0xFF77809E), fontSize: 14),
                      children: [
                        WidgetSpan(
                          child: GestureDetector(
                            child: Image.asset("assets/images/home/homebutton.png",width: 6,height: 6),
                            onTap: () {

                            },
                          ),
                        )]
                  )
              )
          )
      )
          : null,
      controller: _tabController2,
      tabs: _tabData01
  );
}